using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

/// <summary>
/// 非采物料库存
/// </summary>
[Tenant(TPMConst.TPMConfigId)]
[SugarTable("PartsStock", "非采物料库存")]
public class PartsStock
{
    /// <summary>
    /// 
    /// </summary>
    [SugarColumn(ColumnName = "Id", ColumnDescription = "", IsPrimaryKey = true)]
    public Guid Id { get; set; }

    /// <summary>
    /// 物料编号
    /// </summary>
    [SugarColumn(ColumnName = "PartNo", ColumnDescription = "物料编号", Length = 50)]
    [Required, MaxLength(50)]
    public string PartNo { get; set; } = string.Empty;

    /// <summary>
    /// 部门或车间
    /// </summary>
    [SugarColumn(ColumnName = "Workshop", ColumnDescription = "部门或车间")]
    public Guid Workshop { get; set; }

    /// <summary>
    /// 仓位
    /// </summary>
    [SugarColumn(ColumnName = "Location", ColumnDescription = "仓位")]
    public Guid Location { get; set; }

    /// <summary>
    /// 库存数量
    /// </summary>
    [SugarColumn(ColumnName = "StockNum", ColumnDescription = "库存数量")]
    public decimal StockNum { get; set; }

    /// <summary>
    /// 批次号
    /// </summary>
    [SugarColumn(ColumnName = "BatchNumber", ColumnDescription = "批次号", Length = 10)]
    [MaxLength(10)]
    public string? BatchNumber { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 200)]
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    [SugarColumn(ColumnName = "CreateUser", ColumnDescription = "创建人", Length = 20)]
    [Required, MaxLength(20)]
    public string CreateUser { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnName = "CreateTime", ColumnDescription = "创建时间")]
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 修改人
    /// </summary>
    [SugarColumn(ColumnName = "UpdateUser", ColumnDescription = "修改人", Length = 20)]
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 修改时间
    /// </summary>
    [SugarColumn(ColumnName = "UpdateTime", ColumnDescription = "修改时间")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// Location (仓位) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(Location),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_Location { get; set; }

    /// <summary>
    /// Workshop (部门或车间) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(Workshop),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_Workshop { get; set; }

    /// <summary>
    /// CreateUser (创建人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CreateUser),nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_CreateUser { get; set; }

    /// <summary>
    /// UpdateUser (修改人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(UpdateUser),nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_UpdateUser { get; set; }

    /// <summary>
    /// PartNo (物料编号) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(PartNo),nameof(Parts.PartNo))]//多对一
    public Parts parts_PartNo { get; set; }
}